<template>
  <div>
    <nav-bar title="设置"></nav-bar>
    <div class="maxinBox">
      <van-cell title="修改密码" is-link to="UpdatePassword" />
      <van-cell title="首页常用功能设置" is-link to="SettingHome" />
      <van-button round block plain type="info" @click="loginOut">
        <span>退出当前账号</span>
      </van-button>
    </div>
  </div>
</template>

<script>
  import userApi from '../../../api/userAPI.js'
  export default {
    methods:{
      loginOut() {
        this.$dialog.confirm({
          title: '退出登录',
          message: '确认退出登录吗？',
        }).then(() => {
          userApi.loginOut().then(res => {
            localStorage.removeItem('token');
            localStorage.removeItem('userName');
            localStorage.removeItem('userType');
            localStorage.removeItem('userStatus');
            localStorage.removeItem('projectData')
            this.$router.push({
              path: '/'
            })
          })
        });
      }
    }
  }
</script>

<style scoped lang="scss">
  .van-button{
    width: 70%;
    position: absolute;
    bottom: 10%;left: 15%;
  }
</style>
